package com.microtf.inscription.framework.pojo.wechat.jackson;


import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;

import java.io.IOException;
import java.util.Date;

/**
 * 将unixtime转成date类型
 * @author guliuzhong
 */
public class JacksonUnixTimeDeSerialize extends JsonDeserializer<Date> {
    @Override
    public Date deserialize(JsonParser p, DeserializationContext ctxt) throws IOException, JsonProcessingException {
        return new Date(Long.parseLong(p.getText())*1000);
    }
}
